set more off

use "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 6 Regionalism\Data\base panel mexico 2006.dta", clear 

gen respond1=1 if dia~=.
gen respond2=1 if dia_2~=.
gen respond3=1 if dia_3~=.
recode respond* (.=0)

*I am downweighting the states that were oversampled, including df
gen pweight=1
replace pweight=160/(160+500) if estado==9
replace pweight=80/(80+140) if estado==7
replace pweight=100/(80+100) if estado==14
replace pweight=60/(80+60) if estado==20	
svyset [pweight=pweight], psu(municipi)

*note that those in the cross-sectional samples answered shorter questionnaires and were not reinterviewed
drop if tipomu_2==4
drop if tipomu_3==4

*R's vote choice
	*CHANGED VOTE (DV)
label define vote 1 "Calderón" 2 "Madrazo" 3 "López Obrador" 5 "Patricia Mercado" 6 "Others" 7 "Abstain"

recode p8 4=6 5=5 6=7 7/9=7 .=7, gen(vote_w1)
replace vote_w1=. if respond1==0
label values vote_w1 vote

recode p7_2 4=6 6=6 7/9=7 .=7, gen(vote_w2)
replace vote_w2=. if respond2==0
label values vote_w2 vote

recode p6_3 4=6 6=6 7/9=7 .=7, gen(vote_w3)
replace vote_w3=. if respond3==0
label values vote_w3 vote

		*THRESHOLD 
	*For Calderon voters
egen tempamlomadrazo=rowmean(p20b_2 p20c_2)
egen tempfc=rowmean(p20a_2)
gen fc_threshold2temp=tempfc-tempamlomadrazo
gen fc_threshold2=(fc_threshold2temp+10)/20

	*For Madrazo voters
egen tempfcamlo=rowmean(p20a_2 p20c_2)
egen tempmad=rowmean(p20b_2)
gen madrazo_threshold2temp=tempmad-tempfcamlo
gen madrazo_threshold2=(madrazo_threshold2temp+10)/20

	*For AMLO voters
egen tempfcmadrazo=rowmean(p20a_2 p20b_2 )
egen tempamlo=rowmean(p20c_2)
gen amlo_threshold2temp=tempamlo-tempfcmadrazo
gen amlo_threshold2=(amlo_threshold2temp+10)/20

/* QUESTION #39/40 */ 

gen capital = 4 if p39==1 & p40==1 
replace capital = 3 if [p39==1 & p40==2] | [p39==1 & p40==3] 
replace capital = 2 if p39==3 
replace capital = 1 if [p39==2 & p40==2] | [p39==2 & p40==3] 
replace capital = 0 if p39==2 & p40==1  
/* QUESTION #41/42 */ 
gen abortion = 0 if p41==1 & p42==1 
replace abortion = 1 if [p41==1 & p42==2] | [p41==1 & p42==3] 
replace abortion = 2 if p41==3 
replace abortion = 3 if [p41==2 & p42==2] | [p41==2 & p42==3] 
replace abortion = 4 if p41==2 & p42==1  
/* QUESTION #43/44 */ 
gen privatize = 4 if p43==1 & p44==1 
replace privatize = 3 if [p43==1 & p44==2] | [p43==1 & p44==3] 
replace privatize = 2 if p43==3 
replace privatize = 1 if [p43==2 & p44==2] | [p43==2 & p44==3] 
replace privatize = 0 if p43==2 & p44==1  
/* QUESTION #46/47 */ 
gen usatrade = 4 if p46==1 & p47==1 
replace usatrade = 3 if [p46==1 & p47==2] | [p46==1 & p47==3] 
replace usatrade = 2 if p46==3 | p46==4 
replace usatrade = 1 if p46==2 & p47==2 | p46==2 & p47==3 
replace usatrade = 0 if p46==2 & p47==1 


		*AWARENESS
recode p32a 4=1 1=0 2=0 3=0 5=0 6=0 7=0 8=0 9=0, gen(correct1)
recode p32b 2=1 1=0 3=0 4=0 5=0 6=0 7=0 8=0 9=1, gen(correct2)
recode p32c 1=1 2=0 3=0 4=0 5=0 6=0 7=0 8=1 9=0, gen(correct3)
recode p32d 3=1 1=0 2=0 4=0 5=0 6=0 7=1 8=0 9=0, gen(correct4)
recode p71 1=1 2=0 3=0 4=0, gen(correct5)
recode p72a-p72c p65a_3 p65b_3 p65c_3 (2=0)
gen correct6=p72a
gen correct7=p72b
gen correct8=p72c
gen correct12=p65a_3
gen correct13=p65b_3
gen correct14=p65c_3
egen correct_poderes=anycount(correct6 correct7 correct8), values(1)
egen correct_poderes3=anycount(correct12 correct13 correct14), values(1)
recode p69a_2 1=1 2/6=0 .=., gen(correct9)
replace correct9=. if respond2~=1
recode p69b_2 2=1 1=0 3/6=0 .=., gen(correct10)
replace correct10=. if respond2~=1
recode p69c_2 3=1 1/2=0 4/6=0 .=., gen(correct11)
replace correct11=. if respond2~=1
egen ft_know=rownonmiss(p21a p21b p21c p21d p21e p21f p21g p21h p21i p21j p21k p21l p21m)

svy: irt grm correct1 correct2 correct3 correct4 correct5 correct_poderes correct_poderes3 correct9 correct10 correct11 ft_know, difficult
predict irt_know, latent ebmeans
egen awarez=std(irt_know)


		*PARTISAN INTENSITY (IV)
recode p22 1=1 2=.5 3=0 4=0 5=0 6=0 7=0 8=0 9=0,  gen(panintense1)
recode p22 1=0 2=0 3=1 4=.5 5=0 6=0 7=0 8=0 9=0, gen(priintense1)
recode p22 1=0 2=0 3=0 4=0 5=1 6=.5 7=0 8=0 9=0, gen(prdintense1)

recode p22 7/9=1 else=0, gen(party_base1)

*PARTY CLIENTELISM
recode p30a_3-p30g_3 (1/6=1) (else=.)
gen pan_client3=1 if p30a_3==1 | p30e_3==1
gen pri_client3=1 if p30b_3==1 | p30f_3==1
gen prd_client3=1 if p30c_3==1 | p30g_3==1
gen other_client3=1 if p30h_3==1 | p30d_3==1
recode pan_client3 pri_client3 prd_client3 other_client3 (.=0)

*PARTY CONTACTING 
gen pan_contact3=1 if p28a_3==1 | p28e_3==1
gen pri_contact3=1 if p28b_3==1 | p28f_3==1
gen prd_contact3=1 if p28c_3==1 | p28g_3==1
gen other_contact3=1 if p28d_3==1 | p28h_3==1
recode pan_contact3 pri_contact3 prd_contact3 other_contact3 (.=0)

sort folio
merge folio using "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Publications Old\Paper Schaffer\Mexico\discussants.dta"

drop if respond2==0
drop if respond3==0

*Prelude to first reshape below that will convert to one line per discussant from one line per Respondent 
rename p66a_2 disc_mention_w21
rename p66b_2 disc_mention_w22
rename p66c_2 disc_mention_w23

rename p48a_3 disc_mention_w31
rename p48b_3 disc_mention_w32
rename p48c_3 disc_mention_w33

rename p67a_2 disc_relation_w21
rename p67b_2 disc_relation_w22
rename p67c_2 disc_relation_w23

rename p49a_3 disc_relation_w31
rename p49b_3 disc_relation_w32
rename p49c_3 disc_relation_w33 

rename p68a_2 disc_vote_w21
rename p68b_2 disc_vote_w22
rename p68c_2 disc_vote_w23

rename p50a_3 discpresvote_w31
rename p50b_3 discpresvote_w32
rename p50c_3 discpresvote_w33

*Create variable for when wave 3 discussant was named in wave 2. Equals zero if not mentioned in wave 2
rename discussant1 disc_w3_when_mentioned_in_w2_1
rename discussant2 disc_w3_when_mentioned_in_w2_2
rename discussant3 disc_w3_when_mentioned_in_w2_3

*Create binary variable of whether wave 3 discussant was mentioned in wave 2
gen disc_w2_mentioned_in_w3_1=1 if disc_w3_when_mentioned_in_w2_1==1 | disc_w3_when_mentioned_in_w2_2==1 | disc_w3_when_mentioned_in_w2_3==1
gen disc_w2_mentioned_in_w3_2=1 if disc_w3_when_mentioned_in_w2_1==2 | disc_w3_when_mentioned_in_w2_2==2 | disc_w3_when_mentioned_in_w2_3==2
gen disc_w2_mentioned_in_w3_3=1 if disc_w3_when_mentioned_in_w2_1==3 | disc_w3_when_mentioned_in_w2_2==3 | disc_w3_when_mentioned_in_w2_3==3

gen discpresvote_w21=disc_vote_w21 if disc_w3_when_mentioned_in_w2_1==1
replace discpresvote_w21=disc_vote_w22 if disc_w3_when_mentioned_in_w2_1==2
replace discpresvote_w21=disc_vote_w23 if disc_w3_when_mentioned_in_w2_1==3

gen discpresvote_w22=disc_vote_w21 if disc_w3_when_mentioned_in_w2_2==1
replace discpresvote_w22=disc_vote_w22 if disc_w3_when_mentioned_in_w2_2==2
replace discpresvote_w22=disc_vote_w23 if disc_w3_when_mentioned_in_w2_2==3

gen discpresvote_w23=disc_vote_w21 if disc_w3_when_mentioned_in_w2_3==1
replace discpresvote_w23=disc_vote_w22 if disc_w3_when_mentioned_in_w2_3==2
replace discpresvote_w23=disc_vote_w23 if disc_w3_when_mentioned_in_w2_3==3

*Convert data to one row per discussant. Be aware: Note it's a bit tricky b/c wave 2 discussant in a given row is usually different from a wave 3 discussant in the same row. 
reshape long discpresvote_w3 discpresvote_w2 disc_mention_w2 disc_mention_w3 disc_relation_w2 disc_relation_w3 disc_w3_when_mentioned_in_w2_ disc_w2_mentioned_in_w3_, i(folio) j(discuss)
order discpresvote_w3 discpresvote_w2 disc_mention_w2 disc_mention_w3 disc_relation_w2 disc_relation_w3 disc_w3_when_mentioned_in_w2_ disc_w2_mentioned_in_w3_, last
reshape long discpresvote_w vote_w disc_mention_w disc_relation_w respond, i(folio discuss) j(wave)
order discpresvote_w vote_w disc_mention_w disc_relation_w, last

recode disc_relation_w 1/2=1 3/7=0 else=., gen(discfamily)

sort folio discuss wave

gen newid=folio*10+discuss
xtset newid wave

recode discpresvote_w 1=1 2=2 3=3 4/5=6 6/7=7 
recode vote_w 1=1 2=2 3=3 5/6=6 7=7, gen(presvote)
label values presvote vote
label values discpresvote_w	vote

*listwise deletion
constraint drop _all
/*
constraint define 3 [Roberto_Madrazo]L2.prdintense1
constraint define 4 [AMLO]L2.priintense1
constraint define 5 [Roberto_Madrazo]prd_client3
constraint define 6 [AMLO]pri_client3
constraint define 7 [Roberto_Madrazo]prd_contact3
constraint define 8 [AMLO]pri_contact3
*/

recode p26 1=5 2=4 3=3 4=2 5=1 6=3, gen(fox_approve)
recode p54 1=5 2=4 3=3 4=2 5=1 6=3, gen(fox_econ)

recode discpresvote_w 2=3 3=2, gen(discpresvote_dv)
recode presvote 2=3 3=2, gen(presvote_dv)
label define vote_dv 1 "Calderón" 2 "López Obrador" 3 "Madrazo" 5 "Patricia Mercado" 6 "Others" 7 "Abstain"
label values discpresvote_dv vote_dv
label values presvote_dv vote_dv

	*Full Model
*Table A.8
eststo clear
eststo: mlogit presvote_dv i.discpresvote_dv l.i.discpresvote_dv l2.fox_approve l2.fox_econ l2.priintense1 l2.prdintense1 l2.party_base1 l2.usatrade l2.privatize l2.abortion l2.capital  l.i.presvote_dv l2.i.presvote_dv ///
if presvote_dv<6 & wave==3 [pweight=pweight], cluster(folio) base(1)
mat define eb= get(_b)
mat define eV=get(VCE)

mat B1=eb["y1","López_Obrador:1b.discpresvote_dv".."López_Obrador:7.discpresvote_dv"]
mat B2=eb["y1","Madrazo:1b.discpresvote_dv".."Madrazo:7.discpresvote_dv"]
mat V1a=eV["López_Obrador:1b.discpresvote_dv","López_Obrador:1b.discpresvote_dv"]
mat V2a=eV["López_Obrador:2.discpresvote_dv","López_Obrador:2.discpresvote_dv"]
mat V3a=eV["López_Obrador:3.discpresvote_dv","López_Obrador:3.discpresvote_dv"]
mat V4a=eV["López_Obrador:6.discpresvote_dv","López_Obrador:6.discpresvote_dv"]
mat V5a=eV["López_Obrador:7.discpresvote_dv","López_Obrador:7.discpresvote_dv"]
mat V1b=eV["Madrazo:1b.discpresvote_dv","Madrazo:1b.discpresvote_dv"]
mat V2b=eV["Madrazo:2.discpresvote_dv","Madrazo:2.discpresvote_dv"]
mat V3b=eV["Madrazo:3.discpresvote_dv","Madrazo:3.discpresvote_dv"]
mat V4b=eV["Madrazo:6.discpresvote_dv","Madrazo:6.discpresvote_dv"]
mat V5b=eV["Madrazo:7.discpresvote_dv","Madrazo:7.discpresvote_dv"]
mat B=[.,B1,.,B2]
mat V=[.,V1a,V2a,V3a,V4a,V5a,.,V1b,V2b,V3b,V4b,V5b]
mat BFull=[B]'
mat VFull=[V]'
svmat BFull 
svmat VFull 

gen n=_n*-1

gen upperFull=BFull+1.9645*(VFull^.5)
gen lowerFull=BFull-1.9645*(VFull^.5)

*Figure 4.5D
twoway (rcap upperFull lowerFull n if n>-13, color(black) horizontal ) (scatter n BFull if n>-13, mcolor(black)) , ///
xtitle("{bf:Multinomial Logit Coefficient}", size(medium)) ///
graphregion(color(white)) plotregion(lstyle(yxline) lcolor(black)) ytitle("") ///
legend(off) xline(0, lcolor(black)) yline(-6.5, lcolor(black))  ///
ylab(-2 "Alter vote choice=Calderón" -3 "{bf:Alter vote choice=AMLO}" -4 "Alter vote choice=Madrazo" -5 "Alter vote choice=other" -6 "Alter vote choice=none" ///
-8 "Alter vote choice=Calderón" -9 "Alter vote choice=AMLO" -10 "{bf:Alter vote choice=Madrazo}" -11 "Alter vote choice=other" -12 "Alter vote choice=none", ///
angle(horizontal) notick )  yscale(range(-12 -1)) xscale(range(0 3)) ///
xlab(-1.5 -1 -.5 0 .5 1 1.5 2 2.5 3 3.5) ytick(-6.5, tlength(45) tlcolor(black)) ytitle("{bf:Independent Variables}", size(medium)) text(-1 1 "{bf:Pr(Y{it:{sub:e}}=AMLO) {&frasl} Pr(Y{it:{sub:e}}=Calderón)}", bcolor(white) box) ///
text(-7 1 "{bf:Pr(Y{it:{sub:e}}=Madrazo) {&frasl} Pr(Y{it:{sub:e}}=Calderón)}", bcolor(white) box)  note("{it:N}=928", span size(medsmall))

graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 4 Campaigns\Figures\Mex2006DyadicFull.tif", as(tif) replace
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR4_5D.tif", as(tif) replace width(1500)
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR4_5D.pdf", as(pdf) replace 

tab discpresvote_dv, gen(discpresvote_dv)
tab presvote_dv, gen(presvote_dv)

*Get predicted probs and RR
mlogit presvote_dv discpresvote_dv2 discpresvote_dv3 discpresvote_dv4 discpresvote_dv5 l.discpresvote_dv2 l.discpresvote_dv3 l.discpresvote_dv4 l.discpresvote_dv5 ///
l2.fox_approve l2.fox_econ l2.priintense1 l2.prdintense1 l2.party_base1 l2.usatrade l2.privatize l2.abortion l2.capital  l.presvote_dv2 l.presvote_dv3 l.presvote_dv4 l.presvote_dv5 l2.presvote_dv2 l2.presvote_dv3 l2.presvote_dv4 l2.presvote_dv5 /// 
if presvote_dv<6 & wave==3 [pweight=pweight], cluster(folio) base(1)

margins, at(discpresvote_dv2==0 discpresvote_dv3 ==0 discpresvote_dv4 ==0 discpresvote_dv5==0 l.discpresvote_dv2==0 l.discpresvote_dv3 ==0 l.discpresvote_dv4 ==0 l.discpresvote_dv5 ==0 ///
) atmeans predict(outcome(1)) predict(outcome(2)) predict(outcome(3))

	*Stable Discussants
*Table A.8
eststo: mlogit presvote_dv i.discpresvote_dv l2.fox_approve l2.fox_econ l2.priintense1 l2.prdintense1 l2.party_base1 l2.usatrade l2.privatize l2.abortion l2.capital  l.i.presvote_dv l2.i.presvote_dv ///
if presvote_dv<6 & wave==3 & discpresvote_dv==l.discpresvote_dv [pweight=pweight], cluster(folio)  base(1)

mat define eb= get(_b)
mat define eV=get(VCE)
mat B1=eb["y1","López_Obrador:1b.discpresvote_dv".."López_Obrador:7.discpresvote_dv"]
mat B2=eb["y1","Madrazo:1b.discpresvote_dv".."Madrazo:7.discpresvote_dv"]
mat V1a=eV["López_Obrador:1b.discpresvote_dv","López_Obrador:1b.discpresvote_dv"]
mat V2a=eV["López_Obrador:2.discpresvote_dv","López_Obrador:2.discpresvote_dv"]
mat V3a=eV["López_Obrador:3.discpresvote_dv","López_Obrador:3.discpresvote_dv"]
mat V4a=eV["López_Obrador:6.discpresvote_dv","López_Obrador:6.discpresvote_dv"]
mat V5a=eV["López_Obrador:7.discpresvote_dv","López_Obrador:7.discpresvote_dv"]
mat V1b=eV["Madrazo:1b.discpresvote_dv","Madrazo:1b.discpresvote_dv"]
mat V2b=eV["Madrazo:2.discpresvote_dv","Madrazo:2.discpresvote_dv"]
mat V3b=eV["Madrazo:3.discpresvote_dv","Madrazo:3.discpresvote_dv"]
mat V4b=eV["Madrazo:6.discpresvote_dv","Madrazo:6.discpresvote_dv"]
mat V5b=eV["Madrazo:7.discpresvote_dv","Madrazo:7.discpresvote_dv"]
mat B=[.,B1,.,B2]
mat V=[.,V1a,V2a,V3a,.,V5a,.,V1b,V2b,V3b,.,V5b]
mat BDiscStable=[B]'
mat VDiscStable=[V]'
svmat BDiscStable 
svmat VDiscStable 

*gen n=_n*-1

gen upperDiscStable=BDiscStable+1.9645*(VDiscStable^.5)
gen lowerDiscStable=BDiscStable-1.9645*(VDiscStable^.5)

replace BDiscStable=. if VDiscStable==.

*Figure 4.6D
twoway (rcap upperDiscStable lowerDiscStable n if n>-13, color(black) horizontal ) (scatter n BDiscStable if n>-13, mcolor(black)) , ///
xtitle("{bf:Multinomial Logit Coefficient}", size(medium)) ///
graphregion(color(white)) plotregion(lstyle(yxline) lcolor(black)) ytitle("") ///
legend(off) xline(0, lcolor(black)) yline(-6.5, lcolor(black))  ///
ylab(-2 "Alter vote intention=Calderón" -3 "{bf:Alter vote intention=AMLO}" -4 "Alter vote intention=Madrazo" -5 "Alter vote intention=other" -6 "Alter vote intention=none" ///
-8 "Alter vote intention=Calderón" -9 "Alter vote intention=AMLO" -10 "{bf:Alter vote intention=Madrazo}" -11 "Alter vote intention=other" -12 "Alter vote intention=none", ///
angle(horizontal) notick )  yscale(range(-12 -1)) xscale(range(0 3)) ///
xlab(-1.5 -1 -.5 0 .5 1 1.5 2 2.5 3 3.5) ytick(-6.5, tlength(49) tlcolor(black)) ytitle("{bf:Independent Variables}", size(medium)) text(-1 1 "{bf:Pr(Y{it:{sub:e}}=AMLO) {&frasl} Pr(Y{it:{sub:e}}=Calderón)}", bcolor(white) box) ///
text(-7 1 "{bf:Pr(Y{it:{sub:e}}=Madrazo) {&frasl} Pr(Y{it:{sub:e}}=Calderón)}", bcolor(white) box)  note("{it:N}=644", span size(medsmall))

graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 4 Campaigns\Figures\Mex2006DyadicStable.tif", as(tif) replace
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR4_6D.tif", as(tif) replace width(1500)
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR4_6D.pdf", as(pdf) replace 

xyz
*Get predicted probs and RR
mlogit presvote_dv discpresvote_dv2 discpresvote_dv3 discpresvote_dv4 discpresvote_dv5 l.discpresvote_dv2 l.discpresvote_dv3 l.discpresvote_dv4 l.discpresvote_dv5 ///
l2.fox_approve l2.fox_econ l2.priintense1 l2.prdintense1 l2.party_base1 l2.usatrade l2.privatize l2.abortion l2.capital  l.presvote_dv2 l.presvote_dv3 l.presvote_dv4 l.presvote_dv5 l2.presvote_dv2 l2.presvote_dv3 l2.presvote_dv4 l2.presvote_dv5 /// 
if presvote_dv<6 & wave==3 & discpresvote_dv==l.discpresvote_dv [pweight=pweight], cluster(folio) base(1)

margins, at(discpresvote_dv2==0 discpresvote_dv3 ==0 discpresvote_dv4 ==0 discpresvote_dv5==0 l.discpresvote_dv2==0 l.discpresvote_dv3 ==0 l.discpresvote_dv4 ==0 l.discpresvote_dv5 ==0 ///
) atmeans predict(outcome(1)) predict(outcome(2)) predict(outcome(3))
xyz
cd "C:\Users\Andy Baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 4 Campaigns\Code\Output\"
esttab est1 est2 using Mexico2006dyadic.rtf, label b(3) replace se star(* 0.05 ) nogap onecell ///
title(Table 3.6: The Correlates of Vote Choice in Mexico's 2006 Presidential Election Campaign: Multinomial Logit Models on Dyad-Level Data) ///
modelwidth(6) nonumbers mtitles("Full Sample" "Stable Discussants Sample") compress ///
addnote("Entries are multinomial logit coefficients with robust standard errors (corrected for clustering on main respondent) in parentheses.")

recode presvote_dv 1=0 2=1 else=., gen(cald_amlo)
recode presvote_dv 3=1 1=0 else=., gen(cald_mad)
/*
*recode discpresvote_dv 6=.

*Instrumental Vars
ivregress 2sls cald_amlo l2.fox_approve l2.fox_econ l2.priintense1 l2.prdintense1 l2.party_base1 l2.usatrade l2.privatize l2.abortion l2.capital ///
l.i.presvote_dv l2.i.presvote_dv (i.discpresvote_dv=i.l.discpresvote_dv) if wave==3 [pweight=pweight], cluster(folio)

ivregress 2sls cald_mad l2.fox_approve l2.fox_econ l2.priintense1 l2.prdintense1 l2.party_base1 l2.usatrade l2.privatize l2.abortion l2.capital ///
l.i.presvote_dv l2.i.presvote_dv (i.discpresvote_dv=i.l.discpresvote_dv) if wave==3 [pweight=pweight], cluster(folio)
*/

eststo clear

*Friends only
eststo: mlogit presvote_dv i.discpresvote_dv l.i.discpresvote_dv l2.fox_approve l2.fox_econ l2.priintense1 l2.prdintense1 l2.party_base1 l2.usatrade l2.privatize l2.abortion l2.capital  l.i.presvote_dv l2.i.presvote_dv  ///
if presvote_dv<6 & wave==3 & discfamily==0 [pweight=pweight], cluster(folio) base(1)

eststo: mlogit presvote_dv i.discpresvote_dv l2.fox_approve l2.fox_econ l2.priintense1 l2.prdintense1 l2.party_base1 l2.usatrade l2.privatize l2.abortion l2.capital  l.i.presvote_dv l2.i.presvote_dv  ///
if presvote_dv<6 & wave==3 & discpresvote_dv==l.discpresvote_dv & discfamily==0 [pweight=pweight], cluster(folio)  base(1)

cd "C:\Users\Andy Baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 4 Campaigns\Code\Output\"
esttab est1 est2 using Mexico2006dyadicFRIENDS.rtf, label b(3) replace se star(* 0.05 ) nogap onecell ///
title(Table 3.6: The Correlates of Vote Choice in Mexico's 2006 Presidential Election Campaign: Multinomial Logit Models on Dyad-Level Data: FRIENDS ONLY) ///
modelwidth(6) nonumbers mtitles("Full Sample" "Stable Discussants Sample") compress ///
addnote("Entries are multinomial logit coefficients with robust standard errors (corrected for clustering on main respondent) in parentheses.")
